package com.htsk.city.services.core.enums;

public enum OrderStatus {
    PENDING(0, "待接单"),
    ACCEPTED(1, "已接单(待支付)"),
    PAID(2, "已支付(待评价)"),
    COMPLETED(3, "已完成(已评价)"),
    CANCELLED(4, "用户已取消"),
    REFUSE(5, "师傅拒绝接单"),
    REFUNDED(6, "已退款");

    private int key;
    private String value;

    private OrderStatus(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String getName(int key) {
        for (OrderStatus ot : OrderStatus.values()) {
            if (ot.key == key) {
                return ot.value;
            }
        }
        return "";
    }

    public static OrderStatus getOrderType(int key) {
        for (OrderStatus ot : OrderStatus.values()) {
            if (ot.key == key) {
                return ot;
            }
        }
        return null;
    }

    public int getKey() {
        return key;
    }

    public void setKey(int key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
